package is.progetto2.gui;

import is.progetto2.activity.Activity;
import is.progetto2.activity.Bind;

import javax.swing.table.AbstractTableModel;

public class BindTableModel extends AbstractTableModel {

	private static final long serialVersionUID = 1636222229151070873L;
	private Activity a;
	
	public BindTableModel(Activity a) {
		super();
		this.a = a;
	}

	@Override
	public String getColumnName(int column) {
		switch (column) {
		case 0:
			return "Vin1";
		case 1:
			return "Lav1";
		case 2:
			return "Vin2";
		case 3:
			return "Vin3";
		case 4:
			return "Lav2";
		default:
			return "";
		}
	}

	@Override
	public int getColumnCount() {
		return 5;
	}

	@Override
	public int getRowCount() {
		return a.getBindSize();
	}

	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		Bind b=a.getBind(rowIndex);
		switch (columnIndex) {
		case 0:
			return b.getBind1();
		case 1:
			return b.getJob1();
		case 2:
			return b.getBind2();
		case 3:
			return b.getBind3();
		case 4:
			return b.getJob2();
		default:
			return null;
		}
	}

}
